package com.pucheng.bracelet.viewmodel

import androidx.lifecycle.MutableLiveData
import com.pucheng.bracelet.app.util.CacheUtil
import me.hgj.jetpackmvvm.base.viewmodel.BaseViewModel

class EffectivePeriodViewModel : BaseViewModel() {

    val startTime = MutableLiveData<String>().apply {
        value = CacheUtil.getQuickViewPeriod().split("[-]".toRegex())[0]
    }

    val endTime = MutableLiveData<String>().apply {
        value = CacheUtil.getQuickViewPeriod().split("[-]".toRegex())[1]
    }

    fun saveData() {
        CacheUtil.setQuickViewPeriod("${startTime.value!!}-${endTime.value}")
    }

}